//
// Created by 11510 on 2024/6/25.
//
#include <iostream>
#include <vector>
using namespace std;
void test0(){
    vector<int> number = {1, 2, 4, 4, 4, 7, 8};
    for(auto it = number.begin(); it != number.end();){
        if(*it == 4){
            number.erase(it);
        }else{
            it++;
        }
    }

    /* 清空，但不回收空间 */
    number.clear();
    /* 回收多余空间 */
    number.shrink_to_fit();
    for(auto& elem: number){
        cout << elem << " ";
    }
}

class Point{
public:
    Point(int x = 0, int y = 0):_ix(x), _iy(y){
        printf("Point()");
    }
    Point(const Point& point):_ix(point._ix), _iy(point._iy){
        printf("copy Point()");
    }

private:
    int _ix;
    int _iy;
};

void test1(){
    vector<Point> vec;
//    多执行一次拷贝操作
    vec.push_back(Point(1, 2));
//    只执行一次构造
    vec.emplace_back(1, 2);
}




int main() {
    test1();
    return 0;
}
